import request from "../utils/request";

//所有商品接口在这里面管理

export class Product {
  //添加
  static add = (obj)=>request({
    url:"/product/add",
    method:"post",
    data:{
      // id:obj.id,
      proname:obj.name,
      type:obj.type,
      proinfo:obj.desc,
      status:obj.status,
      price:obj.price,
      consts:1,
      inventory:obj.inventory,
      img:obj.imgUrl
    },
})
  //删除
static del = (id)=>request({
  url:"/product/delete",
  method:"post",
  data:{
    id
  }
})
 //查询
 static find = (name)=>request({
  url:"/product/select",
  method:"post",
  data:{
    proname:name
  }
})
 //更新
 static update = (id,obj)=>request({
  url:"/product/update",
  method:"post",
  data:{
    id,
    proname:obj.name,
    type:obj.type,
    proinfo:obj.desc,
    status:obj.status,
    price:obj.price,
    inventory:obj.inventory,
    img:obj.imgUrl
  }
})
 //列表
 static list = ()=>request({
  url:"/product/prolist",
  method:"get",
})
 //分页
 static page = (pageNum,limit)=>request({
  url:"/product/productlist",
  method:"get",
  params:{
    pageNum,
    limit
  }
})
//分类
// static categorylist = ()=>request({
//   url:"/procategory/categorylist",
//   method:"get",
// })
    
}
